﻿using System;
using System.Collections.Generic;

/*
    Compare.Net
    Nicholas Bambury 
    Created April 2012.

    Compare.Net is a configurable application to compare and reconclie from different sources

    Licence - Microsoft  Public Licence. See http://dbasereader.codeplex.com/license for details.
 
*/

namespace CompreInputs
{
    public enum InputType    
    {
        csvFile = 1,
        tabFile = 2,
        delimtedFile = 3,
        fixedWidthFile = 4,
        excelFile = 5,
        xmlFile = 6,        
        Access = 7,
        SQLServer = 8
    }

    public class ComapreInput
    {
        private InputType m_inputType;

        private String m_inputSource;

        private int m_fieldCount = 0;
        private int m_recordCount = 0;
        private bool m_sourceHeaders = false;
               
        private SortedList<int, List<String>> m_fileData;
        private List<String> m_columnData;
        private List<String> m_recordData;

        private List<int> m_fixedWidths;

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="inputType">Input Type</param>
        /// <param name="inputSource">Input Source, path or connection string</param>
        public void CompareInput(InputType inputType, String inputSource, bool sourceContainsHeaders)
        {
            m_inputType = inputType;
            m_inputSource = inputSource;

            m_fieldCount = 0;
            m_recordCount = 0;
            m_sourceHeaders = sourceContainsHeaders;
        }

        /// <summary>
        /// InitaliseFixedWidths
        /// </summary>
        /// <param name="fixedWidths">List of the column widths for a flat file with fixed widths</param>
        /// <returns>True if successful</returns>
        public bool InitaliseFixedWidths(List<int> fixedWidths)
        {
            m_fixedWidths = fixedWidths;
            return true;
        }

        /// <summary>
        /// ReadInputFile
        /// </summary>
        /// <returns>True if successful</returns>
        public bool ReadInputFile()
        {
            try
            {
                switch (m_inputType)
                {
                    case InputType.csvFile:
                        break;
                    case InputType.tabFile:
                        break;
                    case InputType.delimtedFile:
                        break;
                    case InputType.fixedWidthFile:
                        break;
                    case InputType.xmlFile:
                        break;
                    case InputType.excelFile:
                        break;
                    case InputType.Access:
                        break;
                    case InputType.SQLServer:
                        break;
                    default:
                        return false;
                }

                return true;
            }
            catch (Exception ex)
            {
                return false;
            }
        }
    }
}
